-
Notifications
You must be signed in to change notification settings - Fork 0
Union, tests and fixes #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: migration
Are you sure you want to change the base?
Conversation
graphene_django_pretty/types/base.py
Outdated
| """Base union type.""" | ||
|
|
||
| class Meta: | ||
| types = (None,) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Наверное, стоит добавить проверку, что здесь лежат только DjangoObjectType в методе init_subclass_with_meta
| # replace description from interface if it is not none. | ||
| if field_description.description: | ||
| merged_fields.get(field_name).description = field_description.description | ||
| merged_fields.get( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
можешь плз поправить везде переносы
tests/test_types/test_union.py
Outdated
| from tests.django_setup.models import Article, Author, Post | ||
|
|
||
|
|
||
| class PostType(DjangoObjectType): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тут для тестов, наверное, лучше стоит использовать наш BaseDjangoObjectType
graphene_django_pretty/types/base.py
Outdated
| @classmethod | ||
| def resolve_type(cls, instance, info): | ||
| """Resolving grapql type by models instance.""" | ||
| for type in cls._meta.types: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Здесь бы переименовать на type_, чтобы не перезаписывать внутреннюю функцию python-а
graphene_django_pretty/types/base.py
Outdated
| default_resolver = None | ||
|
|
||
|
|
||
| class BaseUnion(graphene.Union): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тут бы тоже переименовать, что это DjangoModelUnion
No description provided.